package niuke;

public class Test2 {
	public static void main(String[] args) {
		int[] in = new int[] { 1, 10, 2, 12 };
		System.out.println(calculateMax(in));
	}

	public static int calculateMax(int[] prices) {
		int length = prices.length;
		int[][] arr = new int[length - 1][];
		// 对数组进行初始化
		for (int i = 0; i < length - 1; i++) {
			arr[i] = new int[length - i - 1];
		}

		for (int i = 0; i < length; i++) {
			int index = 0;
			for (int j = i + 1; j < length; j++) {
				int temp = prices[j] - prices[i];
				arr[i][index++] = temp;
			}
		}

		for (int i = 0; i < arr.length; i++) {
			for (int j = 0; j < arr[i].length; j++) {
				System.out.print(arr[i][j] + "   ");
			}
		}
		return 0;
	}
}
